package Day08方法;

//定义方法求1+2+...+100的和,并返回求和的结果

public class FangFa05 {
    public static void main(String[] args) {

        int sum = sum();
        System.out.println(sum);
    }

    //定义方法
    public static int sum(){
        int sum = 0;

        for (int i = 1; i <= 100; i++) {
            sum += i;
        }
            return sum;
    }
}
